﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Api.Application.Command.Add;
using Traceability.App.Api.Application.Command.Get;
using Traceability.App.Api.DTO;
using Traceability.App.Domain;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AquacultureController : ControllerBase
    {
        private readonly IMediator mediator;

        public AquacultureController(IMediator mediator) 
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 添加养殖信息1111111
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddAquaculture(AddAquacultureCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 查询养殖信息（养殖master）
        /// 查询养殖信息养殖
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<Aquaculture>> GetAquaculture([FromQuery]GetAquacultureCommand request )
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<BaoDTO>>> GetBao([FromQuery] GetBaoCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddBao(AddBaoCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 修改保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<ApiResult<int>> UpdateBao(UpdateBaoCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 删除保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<ApiResult<int>> DelBao(DelBaoCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 显示养殖企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<AquaculturefarmCompanyModel>> GetYangCompany([FromQuery]GetYangCompanyCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 修改养殖场企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> UpdateAquacultureCompany(UpdateYangCompanyCommand request )
        {
            return mediator.Send(request);
        }
    }
}
